Feat DF-662: Handles a component that doesn't exist in plugin yet#274
Feat DF-662: Handles a component that doesn't exist in plugin yet#274jbarnsley10 wants to merge 1 commit intomainfrom
Conversation
|
| default: | ||
| // @ts-expect-error - may be a type that isn't in ComponentType | ||
| logger.error(`Component type ${def.type} does not exist`) | ||
| component = new Components.TextField(def, options) |
There was a problem hiding this comment.
I'm not sure this is the right approach - it could result in components silently falling back on Text Fields if people aren't proactively monitoring logs.
As far as Designer goes, this could be viable style of approach. But the plugin shouldn't be capturing data if the component isn't valid.
There was a problem hiding this comment.
Ok. This call is used by the preview in designer so blows up if the component does not exist. I'll try to handle this silently in designer so we keep the runner able to throw the error here
There was a problem hiding this comment.
Closing this as the designer now handles an invalid component



Proposed change
A new component can be added with minimal effort.
In tandem with forms-designer PR DEFRA/forms-designer#1223
Jira ticket: DF-662
Type of change
Checklist
README.mdanddocs/*(where appropriate, e.g. new features).npm run test).npm run lint).npm run format).